package com.dtease.agent.biz.ai.wrapper;

import cn.hutool.core.date.DateUtil;
import com.dtease.agent.biz.ai.vo.BasLlmConfigVO;
import com.dtease.agent.core.mybatis.BaseEntityWrapper;

import java.util.Optional;

import static com.dtease.agent.core.constants.BizConstants.TimeFormat.YYYY_MM_DD_HH_MM_SS;

/**
* @description 大模型配置信息视图对象包装类
* @author chentl
* @class BasLlmConfigVOWrapper
* @package com.dtease.agent.biz.ai.wrapper
* @since 2025/5/15 11:12
*/
public class BasLlmConfigVOWrapper extends BaseEntityWrapper<BasLlmConfigVO, BasLlmConfigVO> {

    public static BasLlmConfigVOWrapper build() {
        return new BasLlmConfigVOWrapper();
    }


    @Override
    public BasLlmConfigVO entityVO(BasLlmConfigVO entity) {
        if (!Optional.ofNullable(entity).isPresent()) {
            return entity;
        }

        // 处理时间格式
       if(entity.getCtime() != null) {
            entity.setCtimeStr(DateUtil.format(entity.getCtime(), YYYY_MM_DD_HH_MM_SS));
        }
        if(entity.getMtime() != null) {
            entity.setMtimeStr(DateUtil.format(entity.getMtime(), YYYY_MM_DD_HH_MM_SS));
        }

        return entity;
    }

}
